package com.zbkj.common.enums;

import com.google.common.collect.Maps;
import lombok.Getter;

import java.util.Map;
import java.util.Objects;

/**
 * @Auther:
 * @Date: 2024/9/15 10:48
 * @Description:
 */
public enum EstimateFunModifyStateEnum {

    //修改标识 0 ai解析初始状态 1 手动新增 2 修改 3删除
    MODIFY_STATE0(0, ""),
    MODIFY_STATE1(1, "新增"),
    MODIFY_STATE2(2, "修改"),
    MODIFY_STATE3(3, "删除");

    @Getter
    private int state;
    @Getter
    private String stateStr;

    EstimateFunModifyStateEnum(int state, String stateStr) {
        this.state = state;
        this.stateStr = stateStr;
    }

    public static Map<Integer,String> getStateStrMap() {
        Map<Integer,String> stateStrMap = Maps.newHashMap();
        for(EstimateFunModifyStateEnum senum : EstimateFunModifyStateEnum.values()) {
            stateStrMap.put(senum.getState(),senum.getStateStr());
        }
        return stateStrMap;
    }

    public static String getStateStrFomMap(Map<Integer,String> stateStrMap,Integer state) {
        return stateStrMap.getOrDefault(state,"");
    }

    public static String getStateShowStr(Integer state) {
        if(Objects.isNull(state)){
            return "";
        }
        for(EstimateFunModifyStateEnum senum : EstimateFunModifyStateEnum.values()) {
            if(senum.getState() == state) {
                return senum.getStateStr();
            }
        }
        return "";
    }
}
